package Huihu.src.Duoxiancheng;

public class TestThread {
    public static void main(String[] args) {
        MyThreads thread1=new MyThreads("中国",(int)Math.random()* 1000);
        MyThreads thread2=new MyThreads("美国",(int)Math.random()* 1000);
        MyThreads thread3=new MyThreads("英国",(int)Math.random()* 1000);
        thread1.start();
        thread2.start();
        thread3.start();
    }

}

class MyThreads extends Thread{
    private String WhoAml;
    private int delay;

    public MyThreads(String whoAml, int delay) {
        WhoAml = whoAml;
        this.delay = delay;
    }

    @Override
    public void run() {
        try {
            Thread.sleep(delay);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(WhoAml);
    }
}